package service.impl;

import dao.StudentDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Student;
import service.StudentService;

import java.util.List;

@Service("studentService")
public class StudentServiceImpl implements StudentService {
    //自动按照类型注入(业务层)
    @Autowired
    private StudentDao studentDao;
    @Override
    public List<Student> findAll(Student student,int offset,int pageSize) {
        List<Student> students = studentDao.findAll(student,offset,pageSize);
        return students;
    }

    @Override
    public int addStudent(Student student) {
        return studentDao.addStudent(student);
    }

    @Override
    public Student findStudentById(Integer id) {
        return studentDao.findStudentById(id);
    }

    @Override
    public int updateStudent(Student student) {
        return studentDao.updateStudent(student);
    }

    @Override
    public int deleteStudentBuId(int id) {
        return studentDao.deleteStudentById(id);
    }

    @Override
    public int count(Student student) {
        return studentDao.count(student);
    }
}
